home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / console / svgatext.3 / svgatext / SVGATextMode-1.3 / messages.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-05  |  2.0 KB  |  66 lines

  1. /*  SVGATextMode -- An SVGA textmode manipulation/enhancement tool
  2.  *
  3.  *  Copyright (C) 1995,1996  Koen Gadeyne
  4.  *
  5.  *  This program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2 of the License, or
  8.  *  (at your option) any later version.
  9.  *
  10.  *  This program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *  GNU General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU General Public License
  16.  *  along with this program; if not, write to the Free Software
  17.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. /***
  21.  *** message printing tools
  22.  ***/
  23.  
  24. #ifndef _MESSAGES_H
  25. #define _MESSAGES_H
  26.  
  27. #include "vga_prg.h"   /* for SCREEN_ON */
  28.  
  29. #include "misc.h"
  30.  
  31. void print_msg(char *format,...);
  32.  
  33. extern char* CommandName;
  34. extern bool debug_messages;
  35.  
  36. #define MSGTYP_ERR   3
  37. #define MSGTYP_WARN  2
  38. #define MSGTYP_MSG   1
  39. #define MSGTYP_DBG   0
  40.  
  41. extern int msgtype;
  42.  
  43. /* the "do { ... } while (0)" construct allows us to use these macro's as if they were functions.
  44.  * Otherwise you cannot ALWAYS place a ';' at the end of a message printing macro.
  45.  */  
  46.  
  47. #ifndef NO_DEBUG
  48. #  define PDEBUG(arg)  do { msgtype=MSGTYP_DBG ; print_msg arg; } while (0)
  49. #else
  50. #  define PDEBUG(arg)  do {} while (0)       /* avoids lots of warnings about empty statements */
  51. #endif
  52.  
  53. /* PERROR() must switch screen back on, so you can read the error */
  54. #define PERROR(arg)  do { msgtype=MSGTYP_ERR ; print_msg arg; if (vga_open) SCREEN_ON; exit (1); } while (0)
  55.  
  56. #define PWARNING(arg)  do { msgtype=MSGTYP_WARN ; print_msg arg; } while (0)
  57.  
  58. #define PMESSAGE(arg) do { msgtype=MSGTYP_MSG ; print_msg arg; } while (0)
  59.  
  60. #define PVERSION  do { PDEBUG(("%s version: %s\n", CommandName, VERSION)); } while (0);
  61.     
  62.  
  63.  
  64. #endif
  65.  
  66.